<template>
    <div class="ma-content-block lg:flex justify-between">
      <sa-table ref="crudRef" :options="options" :columns="columns" :searchForm="searchForm">
        <template #cangku="{record}">
           <div>流水: {{ record.order_sn }}</div>
           <div>仓库: {{ record.stockroom_name }}</div>
        </template>
        <template #express="{record}">
           <div>名称: {{ record.express_name }}</div>
           <div>单号: {{ record.express_code }}</div>
           <div>云仓查询单号: {{ record.shipsage_asn_id }}</div>
        </template>
        <template #other="{record}">
           <div>签收状态: {{ record.sign_state_text }}</div>
           <div>发起人: {{ record.hand_name }}</div>
        </template>
        <template #sku="{record}">
           <a-tooltip :content="record.skuStr">
              <div>{{ record.skuStr }}</div>
           </a-tooltip>
        </template>
        <template #time="{record}">
           <div>发起时间: {{ record.create_time }}</div>
           <div>签收时间: {{ record.ruku_time }}</div>
        </template>
        <template #tableBeforeButtons="{record}">
           <a-button class="yellow_color"  type="primary" shape="round" @click="ruku('sync')">云仓入库</a-button>
           <a-button  type="primary"  shape="round" @click="ruku('no_sync')">手动添加入库数量(不同步到云仓)</a-button>
        </template>
        <template #operationAfterExtend="{record}">
           <a-button  type="primary"  size="mini" shape="round" @click="handleFlow(record)">查看流水</a-button>
        </template>
      </sa-table>
      <flow ref="flowRef"></flow>
      <edit ref="editRef" @success="refresh"></edit>
    
    </div>
  </template>
  
  <script setup>
  import { onMounted, ref, reactive, computed } from 'vue'
  import mallApi from '@/api/system/system'
  import SaTable from '@cps/sa-table/index.vue'
  import flow from './flow.vue'
  import edit from './edit.vue'
  import { Message } from '@arco-design/web-vue'
  import { throttle } from 'lodash';
  import { useRouter } from 'vue-router';

  const submitLoading = ref(false)
  const router =useRouter()
  const crudRef = ref()
  const editRef = ref()
  const flowRef =ref()
  const searchForm = ref({
  })
  const options = reactive({
    api: mallApi.cangku_input_list,//表格数据接口
    operationColumnWidth: 100,//操作欄
    columnAlign: 'left',
    pageSimple: false,
    showSearch:false,
    isExpand: false,//展開所有子樹
    
  })
  
  const columns = reactive([
    { title: '入库流水｜仓库', dataIndex: 'cangku', width: 150 },
    { title: '快递', dataIndex: 'express', width: 200 },
    { title: '其他', dataIndex: 'other', width: 150 },
    { title: 'SKU明细', dataIndex: 'sku', width: 200 },
    { title: '时间', dataIndex: 'time', width: 150 },
  ])
  
  const refresh = async () => {
    crudRef.value?.refresh()
  }
  const handleFlow = (data) => { 
    flowRef.value?.open(data)
  }
  const ruku = (type, data) => { 
    editRef.value?.open(type,data)
  }
  const getParams = async () => {
    
  }
  
  
  
  onMounted(async () => {
    getParams()
    refresh()
  })
  </script>
  
  <style scoped>
  .icon {
    width: 1em;
  }
  </style>
  